{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     }
    },
    "colab_type": "code",
    "id": "IWTXM4EVJ0Vp",
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import pickle\n",
    "from collections import defaultdict\n",
    "import re\n",
    "from bs4 import BeautifulSoup\n",
    "import sys\n",
    "import os\n",
    "os.environ['KERAS_BACKEND']='theano'\n",
    "from keras.preprocessing.text import Tokenizer\n",
    "from keras.preprocessing.sequence import pad_sequences\n",
    "from keras.utils.np_utils import to_categorical\n",
    "from keras.layers import Embedding\n",
    "from keras.layers import Dense, Input, Flatten\n",
    "from keras.layers import Conv1D, MaxPooling1D, Embedding, Dropout, LSTM, GRU, Bidirectional\n",
    "from keras.models import Model\n",
    "from keras.callbacks import ModelCheckpoint\n",
    "import matplotlib.pyplot as plt\n",
    "plt.switch_backend('agg')\n",
    "from keras import backend as K\n",
    "from keras.engine.topology import Layer, InputSpec\n",
    "from keras import initializers\n",
    "%matplotlib inline\n",
    "\n",
    "import tensorflow as tf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train len 2064\n",
      "test len 688\n",
      "word2id len 561\n"
     ]
    }
   ],
   "source": [
    "fname_train = '../data/train.pkl'\n",
    "fname_test = '../data/test.pkl'\n",
    "\n",
    "with open(fname_train, 'rb') as inp:\n",
    "    word2id = pickle.load(inp)\n",
    "    id2word = pickle.load(inp)\n",
    "    relation2id = pickle.load(inp)\n",
    "    entity2id = pickle.load(inp)\n",
    "    train = pickle.load(inp)\n",
    "    labels = pickle.load(inp)\n",
    "    position1 = pickle.load(inp)\n",
    "    position2 = pickle.load(inp)\n",
    "    E = pickle.load(inp)\n",
    "inp.close()\n",
    "\n",
    "with open(fname_test, 'rb') as inp:\n",
    "    test = pickle.load(inp)\n",
    "    labels_t = pickle.load(inp)\n",
    "    position1_t = pickle.load(inp)\n",
    "    position2_t = pickle.load(inp)\n",
    "    E_t = pickle.load(inp)\n",
    "inp.close()\n",
    "\n",
    "print(\"train len\", len(train))\n",
    "print(\"test len\", len(test))\n",
    "print(\"word2id len\", len(word2id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "MAX_SEQUENCE_LENGTH = 150\n",
    "EMBEDDING_SIZE = len(word2id) + 1\n",
    "EMBEDDING_DIM = 200\n",
    "\n",
    "POS_SIZE = 38*2+1  \n",
    "POS_DIM = 25\n",
    "ENTITY_DIM = 25 \n",
    "HIDDEN_DIM = 100 \n",
    "\n",
    "\n",
    "TAG_SIZE = len(relation2id)\n",
    "ENTITY_SIZE = len(entity2id)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "embedding_matrix = np.random.random((len(word2id) + 1, EMBEDDING_DIM))\n",
    "for word, i in word2id.items():\n",
    "    embedding_vector = word2id[word]\n",
    "    if embedding_vector is not None:\n",
    "        # words not found in embedding index will be all-zeros.\n",
    "        embedding_matrix[i] = embedding_vector\n",
    "\n",
    "word_embeds = Embedding(len(word2id) + 1,\n",
    "                            EMBEDDING_DIM,\n",
    "                            weights=[embedding_matrix],\n",
    "                            input_length = MAX_SEQUENCE_LENGTH,\n",
    "                            trainable=True)\n",
    "\n",
    "#pos1_embeds = Embedding(POS_SIZE,POS_DIM,input_length = MAX_SEQUENCE_LENGTH)\n",
    "#pos2_embeds = Embedding(POS_SIZE,POS_DIM,input_length = MAX_SEQUENCE_LENGTH)\n",
    "#e_embeds = Embedding(ENTITY_SIZE,ENTITY_DIM,input_length = MAX_SEQUENCE_LENGTH)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     },
     "base_uri": "https://localhost:8080/",
     "height": 289
    },
    "colab_type": "code",
    "executionInfo": {
     "elapsed": 11390,
     "status": "ok",
     "timestamp": 1530790300647,
     "user": {
      "displayName": "Akshat Maheshwari",
      "photoUrl": "//lh5.googleusercontent.com/-f-xJkriVoaI/AAAAAAAAAAI/AAAAAAAAAVQ/TLGa4qObGgQ/s50-c-k-no/photo.jpg",
      "userId": "114426356464940466000"
     },
     "user_tz": -330
    },
    "id": "eExWnv0ALYaG",
    "outputId": "b1c4b12e-3fbf-4c85-e67b-faab3ea88274"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "word_embedding: (None, 150, 200)\n",
      "word_embedding: KerasTensor(type_spec=TensorSpec(shape=(None, 256), dtype=tf.float32, name=None), name='bidirectional/concat:0', description=\"created by layer 'bidirectional'\")\n",
      "pos1: KerasTensor(type_spec=TensorSpec(shape=(None, 64), dtype=tf.float32, name=None), name='dense/BiasAdd:0', description=\"created by layer 'dense'\")\n",
      "pos2: KerasTensor(type_spec=TensorSpec(shape=(None, 64), dtype=tf.float32, name=None), name='dense_1/BiasAdd:0', description=\"created by layer 'dense_1'\")\n",
      "e: KerasTensor(type_spec=TensorSpec(shape=(None, 128), dtype=tf.float32, name=None), name='dense_2/BiasAdd:0', description=\"created by layer 'dense_2'\")\n",
      "pos: KerasTensor(type_spec=TensorSpec(shape=(None, 128), dtype=tf.float32, name=None), name='tf.concat/concat:0', description=\"created by layer 'tf.concat'\")\n",
      "pos_e: KerasTensor(type_spec=TensorSpec(shape=(None, 256), dtype=tf.float32, name=None), name='tf.concat_1/concat:0', description=\"created by layer 'tf.concat_1'\")\n",
      "feature: KerasTensor(type_spec=TensorSpec(shape=(None, 512), dtype=tf.float32, name=None), name='tf.concat_2/concat:0', description=\"created by layer 'tf.concat_2'\")\n",
      "feature: KerasTensor(type_spec=TensorSpec(shape=(None, 64), dtype=tf.float32, name=None), name='dense_3/BiasAdd:0', description=\"created by layer 'dense_3'\")\n",
      "Bidirectional LSTM\n",
      "Model: \"model\"\n",
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "input_2 (InputLayer)            [(None, 150)]        0                                            \n",
      "__________________________________________________________________________________________________\n",
      "input_3 (InputLayer)            [(None, 150)]        0                                            \n",
      "__________________________________________________________________________________________________\n",
      "dense (Dense)                   (None, 64)           9664        input_2[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense_1 (Dense)                 (None, 64)           9664        input_3[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "input_4 (InputLayer)            [(None, 150)]        0                                            \n",
      "__________________________________________________________________________________________________\n",
      "input_1 (InputLayer)            [(None, 150)]        0                                            \n",
      "__________________________________________________________________________________________________\n",
      "tf.concat (TFOpLambda)          (None, 128)          0           dense[0][0]                      \n",
      "                                                                 dense_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense_2 (Dense)                 (None, 128)          19328       input_4[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "embedding (Embedding)           (None, 150, 200)     112400      input_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "tf.concat_1 (TFOpLambda)        (None, 256)          0           tf.concat[0][0]                  \n",
      "                                                                 dense_2[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "bidirectional (Bidirectional)   (None, 256)          336896      embedding[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "tf.concat_2 (TFOpLambda)        (None, 512)          0           tf.concat_1[0][0]                \n",
      "                                                                 bidirectional[0][0]              \n",
      "__________________________________________________________________________________________________\n",
      "dense_3 (Dense)                 (None, 64)           32832       tf.concat_2[0][0]                \n",
      "__________________________________________________________________________________________________\n",
      "dense_4 (Dense)                 (None, 6)            390         dense_3[0][0]                    \n",
      "==================================================================================================\n",
      "Total params: 521,174\n",
      "Trainable params: 521,174\n",
      "Non-trainable params: 0\n",
      "__________________________________________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "sequence_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')\n",
    "pos1_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')\n",
    "pos2_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')\n",
    "e_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')\n",
    "\n",
    "word_embedding = word_embeds(sequence_input)\n",
    "print(\"word_embedding:\",word_embedding.shape)\n",
    "word_embedding = Bidirectional(LSTM(128))(word_embedding)\n",
    "print(\"word_embedding:\",word_embedding)\n",
    "\n",
    "pos1 = Dense(64,input_shape=(input,))(pos1_input)\n",
    "pos2 = Dense(64,input_shape=(input,))(pos2_input)\n",
    "e = Dense(128,input_shape=(input,))(e_input)\n",
    "\n",
    "print(\"pos1:\",pos1)\n",
    "print(\"pos2:\",pos2)\n",
    "print(\"e:\",e)\n",
    "\n",
    "pos = tf.concat([pos1,pos2], 1)\n",
    "print(\"pos:\",pos)\n",
    "pos_e = tf.concat([pos,e], 1)\n",
    "print(\"pos_e:\",pos_e)\n",
    "\n",
    "#pos_e_lstm = Bidirectional(LSTM(128))(pos_e)\n",
    "#print(\"pos_e_lstm:\",pos_e_lstm)\n",
    "feature = tf.concat([pos_e,word_embedding], 1)\n",
    "print(\"feature:\",feature)\n",
    "\n",
    "feature = Dense(64)(feature)\n",
    "print(\"feature:\",feature)\n",
    "\n",
    "preds = Dense(len(relation2id), activation='softmax')(feature)\n",
    "\n",
    "model = Model([sequence_input,pos1_input,pos2_input, e_input],preds)\n",
    "\n",
    "model.compile(loss='categorical_crossentropy',\n",
    "              optimizer='rmsprop',\n",
    "              metrics=['acc'])\n",
    "\n",
    "print(\"Bidirectional LSTM\")\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Train = tf.concat([train,position1,position2,E],1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Test = tf.concat([test,position1_t,position2_t,E_t],1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Test.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "labels = pd.DataFrame(labels)\n",
    "labels = pd.get_dummies(labels[0])\n",
    "labels = np.asarray(labels)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "labels_t = pd.DataFrame(labels_t)\n",
    "labels_t = pd.get_dummies(labels_t[0])\n",
    "labels_t = np.asarray(labels_t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2064, 6)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "labels.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(688, 6)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "labels_t.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     },
     "base_uri": "https://localhost:8080/",
     "height": 1074
    },
    "colab_type": "code",
    "executionInfo": {
     "elapsed": 1702650,
     "status": "ok",
     "timestamp": 1530792237299,
     "user": {
      "displayName": "Akshat Maheshwari",
      "photoUrl": "//lh5.googleusercontent.com/-f-xJkriVoaI/AAAAAAAAAAI/AAAAAAAAAVQ/TLGa4qObGgQ/s50-c-k-no/photo.jpg",
      "userId": "114426356464940466000"
     },
     "user_tz": -330
    },
    "id": "S4xfBNtKLdD2",
    "outputId": "5a3abcce-be20-4c71-c989-5ebc191f064d",
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/50\n",
      "33/33 [==============================] - 23s 552ms/step - loss: 22.3617 - acc: 0.3128\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 2/50\n",
      "33/33 [==============================] - 19s 558ms/step - loss: 8.4840 - acc: 0.4357\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 3/50\n",
      "33/33 [==============================] - 20s 616ms/step - loss: 5.2413 - acc: 0.4732\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 4/50\n",
      "33/33 [==============================] - 20s 601ms/step - loss: 3.7997 - acc: 0.5050\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 5/50\n",
      "33/33 [==============================] - 20s 608ms/step - loss: 3.1758 - acc: 0.5558\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 6/50\n",
      "33/33 [==============================] - 21s 626ms/step - loss: 2.0617 - acc: 0.5872\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 7/50\n",
      "33/33 [==============================] - 20s 609ms/step - loss: 1.7325 - acc: 0.6023\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 8/50\n",
      "33/33 [==============================] - 21s 629ms/step - loss: 1.4734 - acc: 0.6228\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 9/50\n",
      "33/33 [==============================] - 20s 610ms/step - loss: 1.1789 - acc: 0.6612\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 10/50\n",
      "33/33 [==============================] - 20s 610ms/step - loss: 0.9341 - acc: 0.7077\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 11/50\n",
      "33/33 [==============================] - 21s 625ms/step - loss: 0.9076 - acc: 0.6863\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 12/50\n",
      "33/33 [==============================] - 21s 642ms/step - loss: 0.8464 - acc: 0.7179\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 13/50\n",
      "33/33 [==============================] - 21s 626ms/step - loss: 0.9987 - acc: 0.6426\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 14/50\n",
      "33/33 [==============================] - 20s 613ms/step - loss: 0.9110 - acc: 0.6865\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 15/50\n",
      "33/33 [==============================] - 20s 607ms/step - loss: 1.0139 - acc: 0.6519\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 16/50\n",
      "33/33 [==============================] - 20s 606ms/step - loss: 0.8677 - acc: 0.6918\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 17/50\n",
      "33/33 [==============================] - 21s 623ms/step - loss: 0.8625 - acc: 0.7224\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 18/50\n",
      "33/33 [==============================] - 20s 617ms/step - loss: 0.8723 - acc: 0.7053\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 19/50\n",
      "33/33 [==============================] - 20s 617ms/step - loss: 0.9072 - acc: 0.7001\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 20/50\n",
      "33/33 [==============================] - 21s 627ms/step - loss: 1.2389 - acc: 0.6414\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 21/50\n",
      "33/33 [==============================] - 21s 642ms/step - loss: 0.9833 - acc: 0.6855\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 22/50\n",
      "33/33 [==============================] - 21s 634ms/step - loss: 0.7416 - acc: 0.7323\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 23/50\n",
      "33/33 [==============================] - 21s 641ms/step - loss: 0.7854 - acc: 0.7113\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 24/50\n",
      "33/33 [==============================] - 21s 634ms/step - loss: 0.6810 - acc: 0.7473\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 25/50\n",
      "33/33 [==============================] - ETA: 0s - loss: 0.8300 - acc: 0.688 - 24s 741ms/step - loss: 0.8294 - acc: 0.6892\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 26/50\n",
      "33/33 [==============================] - 24s 716ms/step - loss: 0.6854 - acc: 0.7413\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 27/50\n",
      "33/33 [==============================] - 22s 676ms/step - loss: 0.7929 - acc: 0.7043\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 28/50\n",
      "33/33 [==============================] - 22s 661ms/step - loss: 0.7858 - acc: 0.6980\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 29/50\n",
      "33/33 [==============================] - 20s 606ms/step - loss: 0.8099 - acc: 0.6979\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 30/50\n",
      "33/33 [==============================] - 20s 614ms/step - loss: 0.8539 - acc: 0.7199\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 31/50\n",
      "33/33 [==============================] - 21s 632ms/step - loss: 0.6359 - acc: 0.7379\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 32/50\n",
      "33/33 [==============================] - 20s 595ms/step - loss: 0.6692 - acc: 0.7476\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 33/50\n",
      "33/33 [==============================] - 21s 627ms/step - loss: 0.6059 - acc: 0.7651\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 34/50\n",
      "33/33 [==============================] - 20s 614ms/step - loss: 0.6026 - acc: 0.7628\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 35/50\n",
      "33/33 [==============================] - 21s 630ms/step - loss: 0.6325 - acc: 0.7530\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 36/50\n",
      "33/33 [==============================] - 20s 611ms/step - loss: 0.7200 - acc: 0.7366\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 37/50\n",
      "33/33 [==============================] - 20s 617ms/step - loss: 0.6663 - acc: 0.7468\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 38/50\n",
      "33/33 [==============================] - 21s 643ms/step - loss: 0.6137 - acc: 0.7672\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 39/50\n",
      "33/33 [==============================] - 21s 641ms/step - loss: 0.5717 - acc: 0.7808\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 40/50\n",
      "33/33 [==============================] - 21s 650ms/step - loss: 0.7180 - acc: 0.7467\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 41/50\n",
      "33/33 [==============================] - 20s 612ms/step - loss: 0.7077 - acc: 0.7393\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 42/50\n",
      "33/33 [==============================] - 21s 622ms/step - loss: 0.6448 - acc: 0.7481\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 43/50\n",
      "33/33 [==============================] - 19s 590ms/step - loss: 0.6272 - acc: 0.7726\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 44/50\n",
      "33/33 [==============================] - 22s 655ms/step - loss: 0.6793 - acc: 0.7501\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 45/50\n",
      "33/33 [==============================] - 20s 614ms/step - loss: 0.7085 - acc: 0.7330\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 46/50\n",
      "33/33 [==============================] - 20s 605ms/step - loss: 0.6828 - acc: 0.7444\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 47/50\n",
      "33/33 [==============================] - 20s 604ms/step - loss: 0.5243 - acc: 0.7974\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 48/50\n",
      "33/33 [==============================] - 20s 617ms/step - loss: 0.6313 - acc: 0.7772\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 49/50\n",
      "33/33 [==============================] - 20s 605ms/step - loss: 0.5741 - acc: 0.7641\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n",
      "Epoch 50/50\n",
      "33/33 [==============================] - 21s 621ms/step - loss: 0.5917 - acc: 0.7690\n",
      "WARNING:tensorflow:Can save best model only with val_acc available, skipping.\n"
     ]
    }
   ],
   "source": [
    "cp = ModelCheckpoint('model_bilstm.hdf5',monitor='val_acc',verbose=1,save_best_only=True)\n",
    "history = model.fit([train,position1,position2,E], labels,epochs= 50, batch_size = 64,callbacks=[cp])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.rcParams['font.sans-serif']=['simsun'] #用来正常显示中文标签\n",
    "plt.rcParams['axes.unicode_minus']=False #用来正常显示负号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAElCAYAAAAMUeL2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnN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0WxwPc1wKLovmFwJ61reTuk4BJACNGjPBsT+uSekoIyc278p0synd24gj+rxOafv5OeCbo3BjSICI5UFlZycKFC6mo2OylvaxttdVWvPvu154A2eal57tTp06UlJTQvn37Bm+fq94+BwD7m9loQtA/wsyOJzxw+p5cpEFEcm/hwoV069aN/v37Y2YtcozVq1fTrVu3Ftn3liyVb3dn6dKlLFy4kB122KHB2+eqt8/zwMC0RVfn4rgiEq+KiooWDfwCZkbPnj354osvGrWdbvISkRalwN/ysvmO23bwnz2bHe69F5YujTslIrIFyOzdWFVVtXF+1qxZG+fXrl1b53WEVatWMXPmTBYsWMCKFStaJJ250LaD/wcfsP2DD8LChXGnRERiMmfOHB566CEALrroItauXctbb70FwMUXXwzA4sWLufHGGzcWDi+//PLGwuD999/fZH+TJ09mzZo1bL311tx0001AKEQ+/PDDetOxevVqfvvb3zZbvpqqbQf/Hj3CaysunUWkaYYMGUK7du2A0DzSuXNnJk+eDEBhYSEAf/vb3/jNb37DO++8w5577sk555zDHXfcQWlpKWeeeSarVq0CYNmyZTz66KPk5eUxc+ZMli9fzosvvsizzz7LkiVL6k3HG2+8sUX1Soqjq2fuRD+sgr9Ish100EEA5OeHkNe5c+eNn3322Wfk5+dTWFjIrbfeyquvvso111zDuHHj6NSpEx06dABC7f7xxx+nW7duXHnllbg7n3zyCXPmzGH+/Pk8/fTT9aZh1KhRzJgxo4Vy2HhtO/inav7Ll8eaDBEBLroIouaWZjNsGFx7bZ0fP/HEE4wfP57tt9+ehx56aGPwT79A+tFHH/HUU08xbdo0brrpJvbdd18qKyt57LHHuOSSSzj11FMBmD9/PqeccgqzZs3ivPPOo6qqittvv50LL7yQBQsWUFJS0ujk33333QwcOJC5c+dy5pln0rFjR6ZMmUJBQQGTJ0/mhhtuYMCAAbUua6pkBH/V/EUS6eijj+boo4/myiuvBKC6uhrYNPjvvffejB8/ni5dulBSUsLatWvp0aMHK1as4KabbuK2227jwQcfZPDgwQB88MEHnH322Rtr/rNmzWLdunUceeSRXHXVVQ1O29NPP812223HQQcdRO/evbn//vs599xzeeGFF7jhhhvYb7/9WLt2LUCty5qqbQf/rbbCzTAFf5H43Xpry+x39eoGrVZVVbWx7T+9188rr7zChAkTOPXUU1m3bh3PPvssnTt35rXXXqOqqoqDDz54k/2cccYZfOc73+HNN99k0aJFHHPMMQDMnTuXysrKBt9l+9Zbb3HssccCMHDgQG677TYALrjgAi688EJ69+7NL3/5yzqXNVXbvuCbl0dVly5q9hFJuFWrVjFjxgy6d+8O1JwBAOy5557cd999jBgxglWrVjF58mT+/ve/A/Dll18yYcIE1q1bxyOPPMI+++zDxIkTOfDAA/nWt77F+eefT2lpKaWlpZx77rmNatMfMmQI8+fPB0KT0m677Ya7U1FRwX333cfee+/NU089Veuy5tC2a/7AhoIC8lXzF0msVatWMXv2bEaMGMEZZ5wB1NT8N2zYwMyZM7nnnnsYPXo0gwcPpmPHjowZM4ZnnnmG4uJievXqxS233MLll1/OCSecwLp167jxxhs5++yzyc/Pp6KigpNPPnnjheG6lJWVMWvWrI0Dsh155JFMmjQJd+ejjz7irLPOwsy45JJLGDduHMuWLePggw+udVlzaPPBv7JbNzop+IskVvfu3Zk4cSLl5eUUFxcDcN111wFh4Lk99tiDu+66i+rqasrKyjj//PN59dVXGT9+PFOmTKG4uJhdd90VgNdff5133nmHcePGMXv2bD7//HMOPfRQrrnmGqqrqzn55JPZbbfdak1H6gwhxcw499xzv7bes88+26BlTdXmg/+GggI1+4gk3IABAzYZ+z7V6+f666/feB0gLy+PQw45BIC99tqLsrKyjev37t2bRYsWMWjQIEaOHAlAnz59KCkpoVevXlx33XXMnz8/qx4/cUlG8FfNXyTR6nroSSrwN8R22223yfvtt99+k/f9+vVrfMJi1LYv+KLgLxK3XD0tMMmy+Y6TEfzV7CMSi06dOrF06VIVAC0oNZ5/p06dGrVdMpp9ysthwwbIb/PZFdmilJSUsHDhwkaPNd8YFRUVjQ58bUF6vlNP8mqMNh8NN6Se8LNyJfTsGW9iRBKmffv2jXq6VDbKysr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H7gNOAwd680syHA3YTxVQDuBc50908BzOwhM/uPu78XDTQ3ATjY3avMbGtgHKGwSClx98ujbaeZ2S7u/m7LZ1ckULOPJJaZ5QHHuPtLAB7GOpkOHBqtMsPdK6PP5gC7mll7MxsOrE8F/shfgPOj+dOAv7t7VfT+YeCWjMP/NW1+CbBtM2VLpEFU85ck6wW0N7PvpS1bRxgat3st66fGTB9ICNjplgADovn+hEIEAHf/sgFpsYYlWaR5KPhLkn0JVLv7lMwPzOz0WtbvQbg28DHh4SnpelHzbNXFwDYZ+9va3ZchsoVQs48klrtXA2Vm9q3UMjMbYWYDo7cD0pYfAjwdbfM60M3MuqXt7hjgrmh+KnBc1KyUkn52IRI7DeksiWZmWwHXEJp6vgLmuftjUc3/KMIzAjoDOwJXuPuKaLvtgR8Cc4Eu0XbT0vb7XeAw4BNCk86D7j4/etD6X4G73H28me0CTCFcaB7n7utaPtciCv4itYqCf393/0XMSRFpEWr2EclgZkXAkcCoqIunSJujmr+ISAKp5i8ikkAK/iIiCaTgLyKSQAr+IiIJpOAvIpJACv4iIgn0/wNaaa6yKKQ70QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, ax = plt.subplots()#创建一个figure \n",
    "ax.plot(history.history['loss'], '-r', label='训练集 loss')\n",
    "\n",
    "####打开网格\n",
    "ax.grid(True)\n",
    "\n",
    "####定义x, y轴的名称\n",
    "ax.set_xlabel('epoch',fontsize=15)\n",
    "ax.set_ylabel('loss',fontsize=15)\n",
    "\n",
    "####定义标题\n",
    "fig.suptitle('BiLSTM模型损失函数变化曲线',fontsize=15)\n",
    "\n",
    "####展示图例 legend loc=是用来定义图例的位置的，还有很多选择，大家可以自己尝试\n",
    "ax.legend(loc = 'upper right')\n",
    "\n",
    "plt.savefig(\"BiLSTM模型损失函数变化曲线.png\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "50"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(history.history['loss'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[15.422783851623535,\n",
       " 8.114373207092285,\n",
       " 4.992214679718018,\n",
       " 3.6122593879699707,\n",
       " 2.788252353668213,\n",
       " 1.8730120658874512,\n",
       " 1.5130964517593384,\n",
       " 1.3207587003707886,\n",
       " 1.1901321411132812,\n",
       " 0.9941277503967285,\n",
       " 1.0170565843582153,\n",
       " 0.8637735247612,\n",
       " 0.9147672057151794,\n",
       " 0.8466529250144958,\n",
       " 0.8955297470092773,\n",
       " 0.8498474359512329,\n",
       " 0.7917774319648743,\n",
       " 0.7498235106468201,\n",
       " 0.7697475552558899,\n",
       " 0.906852126121521,\n",
       " 0.8163157105445862,\n",
       " 0.7502200603485107,\n",
       " 0.8154125809669495,\n",
       " 0.7194541692733765,\n",
       " 0.8109708428382874,\n",
       " 0.6819730401039124,\n",
       " 0.7137476801872253,\n",
       " 0.701915979385376,\n",
       " 0.7083989381790161,\n",
       " 0.7732797265052795,\n",
       " 0.6657428741455078,\n",
       " 0.7174267768859863,\n",
       " 0.6646221876144409,\n",
       " 0.6512197852134705,\n",
       " 0.6413149833679199,\n",
       " 0.6365796327590942,\n",
       " 0.684639036655426,\n",
       " 0.6737300753593445,\n",
       " 0.6194965243339539,\n",
       " 0.6296554803848267,\n",
       " 0.6244068741798401,\n",
       " 0.6318758130073547,\n",
       " 0.6316161751747131,\n",
       " 0.6225709915161133,\n",
       " 0.6380780935287476,\n",
       " 0.6911188960075378,\n",
       " 0.5883585810661316,\n",
       " 0.6197815537452698,\n",
       " 0.6211687326431274,\n",
       " 0.64442378282547]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "history.history['loss']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     }
    },
    "colab_type": "code",
    "id": "VSLWHsVmkr-8"
   },
   "outputs": [],
   "source": [
    "#from keras.utils.vis_utils import plot_model\n",
    "#plot_model(model, to_file='rnn_model.png', show_shapes=True, show_layer_names=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0, 1, 0, 0],\n",
       "       [0, 0, 0, 0, 1, 0],\n",
       "       [1, 0, 0, 0, 0, 0],\n",
       "       ...,\n",
       "       [1, 0, 0, 0, 0, 0],\n",
       "       [0, 0, 0, 1, 0, 0],\n",
       "       [0, 0, 0, 0, 0, 1]], dtype=uint8)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "labels_t"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "colab": {
     "autoexec": {
      "startup": false,
      "wait_interval": 0
     }
    },
    "colab_type": "code",
    "id": "zdU_K2hMomOJ"
   },
   "outputs": [],
   "source": [
    "res = model.predict([test,position1_t,position2_t,E_t])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[6.5190514e-05, 1.3229872e-02, 3.5317361e-01, 6.3337696e-01,\n",
       "        1.5137500e-04, 2.9217779e-06],\n",
       "       [4.7391137e-07, 8.6145855e-07, 1.7377008e-05, 1.1294054e-06,\n",
       "        9.8268962e-01, 1.7290620e-02],\n",
       "       [8.7337607e-01, 4.3131239e-04, 6.1676151e-06, 2.5506992e-07,\n",
       "        3.5519106e-06, 1.2618268e-01],\n",
       "       ...,\n",
       "       [1.8306161e-01, 3.3416633e-05, 6.8336492e-05, 2.3122150e-06,\n",
       "        7.3492447e-05, 8.1676078e-01],\n",
       "       [8.6630490e-03, 2.4974424e-01, 3.3582377e-01, 3.6625591e-01,\n",
       "        5.2899873e-04, 3.8984068e-02],\n",
       "       [1.2384019e-05, 2.0860903e-11, 1.3159790e-04, 3.2112212e-12,\n",
       "        2.8183268e-11, 9.9985600e-01]], dtype=float32)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = []\n",
    "for item in res:\n",
    "    ls = list(item)\n",
    "    idx = ls.index(max(ls))\n",
    "    add_ls = [0]*6\n",
    "    add_ls[idx] = 1\n",
    "    result.append(add_ls)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 1, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 0, 1, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [0, 1, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [1, 0, 0, 0, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 0, 0, 1],\n",
       " [0, 0, 0, 1, 0, 0],\n",
       " [0, 0, 0, 0, 0, 1]]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "           0     0.8135    0.7649    0.7885       268\n",
      "           1     0.7273    0.5882    0.6504        68\n",
      "           2     0.5667    0.5152    0.5397        33\n",
      "           3     0.5283    0.5600    0.5437        50\n",
      "           4     0.7561    0.6200    0.6813        50\n",
      "           5     0.7004    0.8219    0.7563       219\n",
      "\n",
      "   micro avg     0.7282    0.7282    0.7282       688\n",
      "   macro avg     0.6820    0.6450    0.6600       688\n",
      "weighted avg     0.7322    0.7282    0.7271       688\n",
      " samples avg     0.7282    0.7282    0.7282       688\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from sklearn.metrics import classification_report\n",
    "print(classification_report(labels_t,result,digits = 4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "labels_t_list = []\n",
    "for i in labels_t:\n",
    "    res = list(i).index(1)\n",
    "    labels_t_list.append(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "result_list = []\n",
    "for i in result:\n",
    "    res = list(i).index(1)\n",
    "    result_list.append(res)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(labels_t_list) == len(result_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              precision    recall  f1-score   support\n",
      "\n",
      "           0     0.8135    0.7649    0.7885       268\n",
      "           1     0.7273    0.5882    0.6504        68\n",
      "           2     0.5667    0.5152    0.5397        33\n",
      "           3     0.5283    0.5600    0.5437        50\n",
      "           4     0.7561    0.6200    0.6813        50\n",
      "           5     0.7004    0.8219    0.7563       219\n",
      "\n",
      "    accuracy                         0.7282       688\n",
      "   macro avg     0.6820    0.6450    0.6600       688\n",
      "weighted avg     0.7322    0.7282    0.7271       688\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(classification_report(labels_t_list,result_list,digits = 4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "colab": {
   "default_view": {},
   "name": "RNN.ipynb",
   "provenance": [],
   "version": "0.3.2",
   "views": {}
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
